import board
import digitalio
import time

# Set up the button
button = digitalio.DigitalInOut(board.GPIO18)  # Replace with your GPIO pin
button.direction = digitalio.Direction.INPUT

# Track the previous state of the button
prev_state = button.value

# Main loop
while True:
    current_state = button.value
    if current_state != prev_state:
        if current_state == True:
            print("Trigged")
        else:
            print("Released")
        prev_state = current_state
    time.sleep(0.01)  # Small delay to debounce the button

